#include "qbasekeyboard.h"

#include <QApplication>
#include <QVariant>

#include <QMouseEvent>

using namespace SHAREDLIB;

QBaseKeyBoard::QBaseKeyBoard(int width, int height, QWidget *parent) :
    QWidget(parent),
    m_screen_width(width),
    m_screen_height(height)
{
    this->setAutoFillBackground(true);
}

void QBaseKeyBoard::update_location()
{
    this->move((m_screen_width-this->width())/2,m_screen_height-this->height());
}

void QBaseKeyBoard::set_widget(QWidget *wid)
{
    wid->setParent(this);
    this->resize(wid->size());
    wid->setVisible(true);
    wid->move(0,0);
}

void QBaseKeyBoard::mouseReleaseEvent(QMouseEvent *e)
{
    e->accept();
}

void QBaseKeyBoard::set_capslock(bool capslock)
{
    QObjectList list=this->children();

    while(list.size()>0)
    {
        list.first()->setProperty("capslock",capslock);
        list+=list.first()->children();
        list.removeFirst();
    }
}
